using System;
public static class DateTimeExtensions
{
    public static long ToUnixTime(this DateTime date)
    {
        DateTime d = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
        return Convert.ToInt64((date.ToUniversalTime() - d).TotalSeconds);
    }
	
    public static long ToUnixTimeLong(this DateTime date)
    {
        DateTime d = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
        return Convert.ToInt64((date.ToUniversalTime() - d).TotalMilliseconds);
    }
}